
function isSafe(pwd)
{
	var i = 0;
	var safeLevel = 0;
	var patn1 = /.*\d.*/;
	var patn2 = /.*[a-z].*/;
	var patn3 = /.*[A-Z].*/;
	var patn4 = /.*(~|`|!|@|#|\$|%|\^|&|<|>|\*|\(|\)|\?|\[|\]).*/;
		///.*(~|`|!|@|#|\$|%|\^|&|<|>).*/;
	//.*(\\x5c|~|`|!|@|#|\\$|%|\\^|&|\\*|\\(|\\)|<|>|\\?|/|_|-|\\x7c).*
	
	if(patn1.test(pwd)) i++;
	if(patn2.test(pwd)) i++; 
	if(patn3.test(pwd)) i++;
	if(patn4.test(pwd)) i++;
	if(i < 2)
		safeLevel = 1;
	else if(i == 2 && pwd.length == 6)
		safeLevel = 1;
	else if(i == 2 && pwd.length > 6)
		safeLevel = 2;
	else
		safeLevel = 3;
	if(pwd.length < 6) safeLevel = 0;

	return safeLevel;
}